home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
- GUS Programmer's Digest Wed Jun 9 00:07 Volume 2: Issue 7
-
- Today's Topics:
- Q: Programming GUS and Double Buffering
-
- Standard Info:
- - Meta-info about the GUS can be found at the end of the Digest.
- - Before you ask a question, please READ THE FAQ.
-
- ----------------------------------------------------------------------
-
- Date: Tue, 8 Jun 1993 08:40:35 GMT
- From: av@omega.ssw.de (Andreas Vogel)
- Subject: Q: Programming GUS and Double Buffering
- Message-ID: <1993Jun8.084035.2591@omega.ssw.de>
-
- ReprintFrom: comp.sys.ibm.pc.soundcard
-
- I have two questions concerning the programming of the GUS. Are there
- any GUS wizards out there who could answer my questions?
- I've read the GUS SDK and examined all of the supplied code!
-
- 1) I can't get the GUS playing two buffers smoothly (without pops).
- We have, e.g., two buffers in GUS DRAM full with samples. This is a
- part of an Unix device driver, which will do audio file playing using
- double buffering.
-
- I've tried several methods to get these two buffers played alternating.
-
- a) The first method was to start playing buffer 1, start an volume ramp
- up which will take 20 ms and wait for the WAVE IRQ. After receiving
- the WAVE IRQ, ramp the volume down in 20 ms, wait for the VOL IRQ,
- start the voice on buffer 2 with a ramp up of 20 ms. After buffer 2
- finished just continue with buffer 1 and so on...
-
- Buffer1 Buffer2
- +--,------+ +--,------+
- | / |\ | / |\
- |/ | \ |/ | \
- +---------+ `+---------+ `
-
- b) The method a) uses only one voice. Now try the whole thing with two
- voices. The big difference is that we now start the volume ramp up
- on buffer 2 at the same time as the volume ramp down on buffer 1.
-
- Buffer1 Buffer2
- +--,------+--,------+
- | /voice1 |\/voice2 |\
- |/ |/\ | \
- +---------+--`------+ `
-
-
-
- None of both methods works without popping. I've tried several volume
- ramp rates and volume low settings.
-
- Though, I'm really wondering how to get the problem solved. One idea
- I've had is that the volume ramp down will happen to late. The voice
- on the buffer is then already stopped and maybe this stop generates
- the pop. Maybe a solution would be:
-
- c) Use two voices. Calculate the sample position when to start the
- volume ramp down for each buffer.
-
- Buffer1 Buffer2
- +--,---,--+--,---,--+
- | / \ | / \ |
- |/voice1 \|/voice2 \|
- +---------+---------+
-
- I've not actually tried this method.
-
- It is very time consuming to try more methods (building a new kernel,
- rebooting, ...), so I asking you for your opinion and experience.
-
- The only thing I know for sure is that it is possible, but how?
-
- There should be no assumptions about the positions of the buffers in
- DRAM. It might be that the end addr of buffer 1 != start addr
- of buffer 2.
-
- 2) The GUS SDK says in chapter
-
- 2.6.2.14 Volume Ramp Control Register - (D,8D)
-
- about Bit 2, Rollover condition:
-
- "This bit pertains more towards the location of the voice rather than
- its volume. Its purpose is to generate an IRQ and NOT stop (or loop).
- It will generate an IRQ and the voice's address will continue to move
- thru DRAM in the same direction. This can be a very powerful feature.
- It allows the application to get an interrupt without having the sound
- stop. This can be easily used to implement a ping-pong buffer algorithm
- so an application can keep feeding it data and there will be no pops.
- Even if looping is enabled, it will not loop."
-
- I thought that this feature might help. But I really don't understand,
- how to "implement a ping-pong buffer algorithm" using this method.
- Does someone have an idea on this?
-
-
- Please, if you do have some suggestions, tell it. I'm sure that the answers
- on these topics are of public interest.
-
- Thank's a lot in advance,
-
-
-
- --
- Andreas Vogel Bahnhofstr. 13 / D-7300 Esslingen / Germany
- ab 1.7.1993: 73728 Esslingen
- Voice: +49-711/3967133 (priv.: +49-711/357613)
- E-Mail: av@ssw.de
-
- ------------------------------
-
- End of GUS Programmer's Digest V2 #7
- ************************************
-
- To post to tomorrow's digest: <gus-sdk%itchy@dsd.es.com>
- To (un)subscribe or get help: <gus-sdk-request%itchy@dsd.es.com>
- To contact a human (last resort): <gus-sdk-owner%itchy@dsd.es.com>
-
- FTP sites: archive.epas.utoronto.ca pub/pc/ultrasound
- wuarchive.wustl.edu systems/msdos/ultrasound
- Hints:
- - Get the FAQ from the FTP sites or the request server.
- - Mail to <gus-sdk-request%itchy@dsd.es.com> for info about
- other GUS related mailing lists (UNIX, OS/2, GUS-MIDI, etc.)
-
-
-
-